﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;


namespace MiaProject
{
    class Portal2D : Actor2D
    {
        private const float Rotation = 0;
        private const float Scale = 1.0f;
        private const float Depth = 0.5f;
        public int frames;
        public int framesPerSec;
        public const int CREATE = 0;
        public const int OPEN = 1;
        public const int SEND = 2;

        public bool status;
        public Vector2 pos;
        
        public Portal2D()
        {
            SpriteTexture = new AnimatedTexture(Vector2.Zero, Rotation, Scale, Depth);
            this.frames = 32;
            this.framesPerSec = 8;
            this.animation = new int[3, 2];

            this.animation[CREATE, 0] = 7;
            this.animation[CREATE, 1] = 10;

            this.animation[OPEN, 0] = 10;
            this.animation[OPEN, 1] = 13;

            this.animation[SEND, 0] = 14;
            this.animation[SEND, 1] = 31;


            this.status = true;
            this.currentAnim = -1;

            pos = new Vector2(100, 100);

        }
        public bool animEnded()
        {
            return SpriteTexture.animEndend;
        }
        public void setAnimCreate()
        {
            if (this.currentAnim == CREATE)
                return;
            this.currentAnim = CREATE;
            SpriteTexture.setAnim(getAnimI(), getAnimF());
        }
        public void setAnimOpen()
        {
            if (this.currentAnim == OPEN)
                return;
            this.currentAnim = OPEN;
            SpriteTexture.setAnimChanged(getAnimI(), getAnimF());
        }
        public void setAnimSend()
        {
            if (this.currentAnim == SEND)
                return;
            this.currentAnim = SEND;
            SpriteTexture.setAnimChanged(getAnimI(), getAnimF());
        }

        
        public bool isSended()
        {
            if(SpriteTexture.Frame >= 31)
                return true;
            return false;
        }
        public bool isOpenToSend()
        {
            if (SpriteTexture.Frame >= 23)
                return true;
            return false;
        }

    }
}
